{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "    Age    Site\n",
      "0  10.0  Google\n",
      "1  12.0  Runoob\n",
      "2  13.0    Wiki\n",
      "     Site   Age\n",
      "0  Google  10.0\n",
      "10.0\n",
      "         date  close\n",
      "0  2023-07-12  75.84\n",
      "2023-07-12\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "data = [['Google', 10], ['Runoob', 12], ['Wiki', 13]]\n",
    "\n",
    "# 创建DataFrame\n",
    "df = pd.DataFrame(data, columns=['Site', 'Age'])\n",
    "\n",
    "# 使用astype方法设置每列的数据类型\n",
    "df['Site'] = df['Site'].astype(str)\n",
    "df['Age'] = df['Age'].astype(float)\n",
    "\n",
    "# 筛选2列\n",
    "print(df[['Age', 'Site']])\n",
    "\n",
    "# 根据一列值的条件，筛选2列\n",
    "print(df.loc[df['Site'] == 'Google', ['Site', 'Age']])\n",
    "print(str(df.loc[0, 'Age']))\n",
    "\n",
    "\n",
    "# 示例数据构建（你可替换为真实数据读取等情况）\n",
    "data = {'date': ['2023-07-12'], 'close': [75.84]}\n",
    "df = pd.DataFrame(data)\n",
    "\n",
    "first_date_iloc = df['date'].iloc[0]\n",
    "print(df)\n",
    "print(first_date_iloc)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
